home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-06-18 | 3.0 KB | 166 lines | [TEXT/MPS ] |
- ; CDIconKiller © 1994 Quinn & Peter N Lewis
- ; Written in 4 hours from 02:00 to 05:30 18/June/94
-
- ; Patches GetCatInfo, tests for Custom Icon attribute on
- ; CD-ROM files/folders, and clears it.
-
- ; Detailed description:
-
- ; Init time:
- ; Find the driver refnum for ".AppleCD" and remeber it.
- ; Patch GetCatInfo
-
- ; GetCatInfo Patch:
- ; Test for GetCatInfo selector on HFSDispatch, do nothing otherwise
- ; Call thru
- ; Return immediately on error
- ; Return immediately unless Custom Icon bit set
- ; Walk the volume queue looking for the vrefnum of the GetCatInfo
- ; If we don't find it, we leave
- ; If we do and the driver refnum matches the CD-ROM driver's refnum,
- ; then clear the custom icon bit
- ; Otherwise, we leave
-
- include 'sysequ.a'
- include 'fsequ.a'
- include 'traps.a'
-
- ; procedure ShowIcon (id: integer; delta_x: integer);
- import ShowIcon
-
- main proc export
- movem.l a2/d3,-(sp)
- move.l UTableBase,a2
- move.w UnitNtryCnt,d3
- loop move.l (a2)+,a1
- move.l a1,d0
- beq.s endloop
-
- ; a1 = curDCtlHndl
-
- move.l (a1),a1
- move.l dCtlDriver(a1),a0
- move.l a0,d0
- beq.s endloop
- btst.b #6,dCtlFlags+1(a1) ; test for RAMDriver
- beq.s notram
- move.l (a0),a0
- move.l a0,d0
- beq.s endloop
- notram lea drvrName(a0),a0
- lea cdromstr,a1
- clr.l d0
- move.b (a0)+,d0
- swap d0
- move.b (a1)+,d0
- _CmpString
- beq.s found
-
- endloop subq.w #1,d3
- bne loop
-
- bra bad
-
- OurHFSDispatch
- cmp.w #9,d0 ; Test for GetCatInfo selector
- beq.s doit
- move.l oldHFSDispatch,-(sp) ; Call thru
- rts
-
- doit pea continue
- move.l oldHFSDispatch,-(sp) ; Call thru and continue
- rts
-
- continue tst.w d0
- bne.s fin ; give up on error
-
- btst.b #2,ioFlUsrWds+8(a0)
- beq.s fin ; give up unless custom icon
-
- movem.l a1/d1,-(sp)
-
- move.l VCBQHdr+2,a1 ; first volume control block
-
- move.w ioVRefNum(a0),d1
- lop cmp.w vcbVRefNum(a1),d1
- bne.s cont
-
- move.w drvrrn,d1
- cmp.w vcbDRefNum(a1),d1
- bne.s leave
-
- bclr.b #2,ioFlUsrWds+8(a0) ; clear custom icon
- bra leave
- cont
- move.l (a1),a1 ; next volume control block
- move.l a1,d0
- bne.s lop
-
- leave
- movem.l (sp)+,a1/d1
- clr.w d0
-
- fin tst.w d0
- rts
-
- drvrrn dc.w 0
- oldHFSDispatch dc.l 0
-
- EndHFSDispatch
-
- found sub.w UnitNtryCnt,d3 ; calc driver refnum -(unit num+1)
- subq.w #1,d3
- lea drvrrn,a0
- move.w d3,(a0)
-
- move.w #$A060,d0 ; patch HFSDispatch
- _GetTrapAddress ,newOS
- lea oldHFSDispatch,a1
- move.l a0,(a1)
-
- move.l #EndHFSDispatch-OurHFSDispatch,d0
- _NewPtr ,Sys
- move.l a0,d1
- beq.s bad
-
- move.l a0,a2
-
- move.l a0,a1
- lea OurHFSDispatch,a0
- move.l #EndHFSDispatch-OurHFSDispatch,d0
- _BlockMove
-
- move.w #$A060,d0
- move.l a2,a0
- _SetTrapAddress ,newOS
-
- move.w #128,-(sp)
- move.w #-1,-(sp)
- jsr ShowIcon
- bra.s done
-
- bad
- move.w #129,-(sp)
- move.w #-1,-(sp)
- jsr ShowIcon
-
- done movem.l (sp)+,a2/d3
- rts
-
- string pascal
-
- cdromstr dc.b '.AppleCD'
-
- endp
-
- end
-
- asm -wb "{active}"
- (evaluate "{active}" =~ "/(?*:)®1(?*)/" )> dev:null
- (evaluate "{active}" =~ "/(?*)®2.a/" )> dev:null
- link -rt INIT=128 -ra =ressysheap,reslocked -t INIT -c CDik -o "{®2}" "{active}.o" "{®1}ShowIcon.o"
- setfile -a B "{®2}"
-
-
-
- dumpobj "{®1}SHOWICON.o"